<!DOCTYPE html>
<html style="background-color: #fff;">
<head>
  <meta charset="utf-8">
  <title>layui</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="/graph-benchmark/layui/css/layui.css"  media="all">
  <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>

<style>
#jobInfo{
   min-height:100px;
   overflow-y:auto;
   max-height:300px;
}
/* loading css start*/
  /* Toast */
    .ibox {clear:both;margin: 0px;padding: 0px;width:100%;}
    .ibox .ibox-content {clear: both;line-height: normal;padding:25px;}
    .web_transparent {position: fixed;z-index: 1000;top: 0;right: 0;left: 0;bottom: 0;}
    .web-toast {position: fixed;z-index: 5000;height: 90px;width: 16em;min-height: 4em;top: 365px;margin-left: 120px;background: rgba(40, 40, 40, 0.75);text-align: center;border-radius: 5px;color: #FFFFFF;} 
    .web-toast_content { font-size: 16px;}
    .sk-spinner-three-bounce.sk-spinner{margin: 20px auto 10px;text-align: center; }
    .sk-spinner-three-bounce div {width: 18px;height: 18px;background-color: #f6296d;border-radius: 100%;display: inline-block;-webkit-animation: sk-threeBounceDelay 1.4s infinite ease-in-out;animation: sk-threeBounceDelay 1.4s infinite ease-in-out;-webkit-animation-fill-mode: both;animation-fill-mode: both;}
    .sk-spinner-three-bounce .sk-bounce1 {-webkit-animation-delay: -.32s;animation-delay: -.32s;}
    .sk-spinner-three-bounce .sk-bounce2 {-webkit-animation-delay: -.16s;animation-delay: -.16s;}
    @-webkit-keyframes sk-threeBounceDelay {
        0%,100%,80% {-webkit-transform: scale(0);transform: scale(0);}
        40% {-webkit-transform: scale(1);transform: scale(1);}
    }
    @keyframes sk-threeBounceDelay {
    0%,100%,80% {-webkit-transform: scale(0);transform: scale(0);}
    40% {-webkit-transform: scale(1);transform: scale(1);}
    }
    /*spinner*/
    .pinkspin{color:#ef1a60;}
    .greenspin{color:#07b30b;}
     /* loading css end*/
</style>

<body>


<fieldset class="layui-elem-field layui-field-title" style="margin:0 0 20px">
  <legend style="text-align: center;margin-top: 10px;">数据生成器配置</legend>
</fieldset>
 <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
  <legend>样例数据源连接</legend>
</fieldset>
<form class="layui-form" action="" lay-filter="form_config" id="generateid">
  <div class="layui-form-item">
  <div class="layui-inline">
      <label class="layui-form-label" style="width: 150px;">数据库用户名</label>
      <div class="layui-input-inline">
        <input type="text" name="username" placeholder="neo4j" lay-verify="" autocomplete="off" class="layui-input" style="width: 150px;">
      </div>
    </div>
    
    <div class="layui-inline">
      <label class="layui-form-label" style="width: 150px;">数据库密码</label>
      <input name="passwd" placeholder="..." lay-verify="" autocomplete="off" type="password" class="layui-input" style="width: 150px;">
      <div class="layui-input-inline">
      </div>
    </div>
  </div>
  
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
  <legend>样例数据选择</legend>
</fieldset>

<div class="layui-form-item">
<div style="margin-left:30px;">
    <label class="layui-form-label" style="width:120px;">样例数据选择</label>
    <div class="layui-input-inline">
      <select name="nodetype">
        <option value="">请选择节点类型</option>
        <option value="item_1">起重机零件</option>
      </select>
    </div>
    <div class="layui-input-inline">
      <select name="edgetype">
        <option value="">请选择边类型</option>
        <option value="rel_1">起重机连接方式</option>
      </select>
    </div>
    </div>
  </div>
  
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
  <legend>数据生成配置</legend>
</fieldset>
  
  
  <div class="layui-form-item">
  <!-- <label class="layui-form-label" style="width: 150px;">storm拓扑</label> -->
  <div class="layui-inline">
   <label class="layui-form-label" style="width: 150px;">查询负载组数</label>
      <input type="text" name="querySize" placeholder="1" autocomplete="off" style="width: 150px;float:left;"  class="layui-input">
  
    <label class="layui-form-label" style="width: 150px;">图节点规模</label>
      <input type="text" name="graphSize" placeholder="2000" autocomplete="off" style="width: 150px;float:left;" class="layui-input">
   </div>
   <div class="layui-inline">
    <label class="layui-form-label" style="width: 150px;">图最大层数</label>
      <input type="text" name="graphLayer" placeholder="5" autocomplete="off" style="width: 150px;float:left;"  class="layui-input">
      
       <label class="layui-form-label" style="width: 150px;">生成图个数</label>
      <input type="text" name="graphNum" placeholder="1" autocomplete="off" style="width: 150px;float:left;"  class="layui-input">
    </div> 
  </div>
 
   <!-- 
   <div class="layui-form-item">
  <div class="layui-inline">
      <label class="layui-form-label" style="width: 150px;">GraphSize</label>
      <div class="layui-input-inline">
        <input type="text" name="graphsize" placeholder="2000,5,1" lay-verify="" autocomplete="off" class="layui-input" style="width: 250px;">
      </div>
    </div>
  </div>
   -->
  <div class="layui-form-item">
    <div class="layui-input-block" style="text-align: center;margin-left:0px;">
      <button class="layui-btn" lay-submit=""  lay-filter="submit_conf" style="background-color:#3c8dbc">立即提交</button>
    </div>
  </div>
</form>


<div style="padding: 20px; background-color: #fff;">
  <div class="layui-row layui-col-space15">
    <div class="layui-col-md6" style="width:80%;margin-left:50px;">
      <div class="layui-card">
        <div class="layui-card-header">数据生成日志</div>
        <div class="layui-card-body" id = "jobInfo"></div>
      </div>
      <div>注释：
      	<p>样例数据源: 保存样例数据如起重机BOM图数据的数据库
      	<p>样例数据: 用以模拟生成的真实数据，如起重机的BOM数据，通过分析该样例数据来分析获得数据模型
      	<p>数据生成配置: 指定要生成的数据的特点
      </div>
    </div>
  </div>
</div>   
<div id="jobInfo"></div>    



    
<script src="/graph-benchmark/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="/graph-benchmark/views/js/loading.js"></script> 
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>

layui.use(['form', 'layedit', 'laydate'], function(){
  var form = layui.form;
//  ,laydate = layui.laydate;
  
/*   //日期
  laydate.render({
    elem: '#date'
  });
  laydate.render({
    elem: '#date1'
  }); */
  
  
  //监听提交
  form.on('submit(submit_conf)', function(data){
	/*  {"volume":"1000","nodetype":"1","edgetype":"1","querysize":"1","graphsize":"local"} */ 
	Init.WebToast("BOM图数据生成中...");
	console.log(data)
	 $.ajax({
	    url: 'http://localhost:8080/graph-benchmark/highEchart/startGen',
	    data: { username:data.field.username, passwd:data.field.passwd, 
	    			nodetype:data.field.nodetype,edgetype:data.field.edgetype,
	    			querySize:data.field.querySize,graphSize:data.field.graphSize,
	    			graphLayer:data.field.graphLayer,graphNum:data.field.graphNum},
	    success: function(data) {
	    	//停止加载框
		Init.ClearToast("#webToast", 1)
	    	console.log(data)
	  //  	var points = JSON.parse(point.value)
  		document.getElementById("jobInfo").innerHTML = data.value + "<br>";
	    },
	    cache: false
	  });
    return false;
  });
  
//监听提交
  form.on('submit("submit_add")', function(data){
	/*  {"volume":"1000","nodetype":"1","edgetype":"1","querysize":"1","graphsize":"local"} */ 
	Init.WebToast("测试数据库添加中...");
	console.log(data)
	 $.ajax({
	    url: 'http://localhost:8080/graph-benchmark/highEchart/addDatabase',
	    data: {dbName:data.field.dbName, dbPath:data.field.dbPath},
	    success: function(data) {
	    	//停止加载框
		Init.ClearToast("#webToast", 1)
	    	console.log(data)
	  //  	var points = JSON.parse(point.value)
  	//	document.getElementById("jobInfo").innerHTML = data.value + "<br>";
	    },
	    cache: false
	  });
    return false;
  });
  
});
</script>

</body>
</html>